<!DOCTYPE html>
<html>
<head>
    <title>添加其他收入</title>
                  <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            display: flex;
            flex-direction: column;
            align-items: center; /* 垂直居中 */
        }
        h1 {
            color: #333;
            margin: 20px 0;
        }
        .flash {
            margin: 10px 0;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            width: 80%;
            text-align: center;
        }
        .flash.error {
            background-color: #ffe6e6;
            border-color: #ffcccc;
            color: #b30000;
        }
        .flash.success {
            background-color: #e6ffe6;
            border-color: #ccffcc;
            color: #006600;
        }
        form {
            max-width: 400px;
            margin: 20px auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
            background-color: #f9f9f9;
            width: 80%;
        }
        label {
            display: block;
            margin: 10px 0;
        }
        input[type="text"],
        input[type="number"],
        input[type="file"] {
    
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            width: calc(100% - 20px); /* 减去左右 padding */
        }
        button {
            padding: 10px 20px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
        }
        button:hover {
            background-color: #0056b3;
        }
        a {
            display: block;
            margin: 10px 0;
            text-decoration: none;
            color: #007BFF;
            font-size: 16px;
            text-align: center;
            width: 80%;
        }
        a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <h1>添加其他收入</h1>
    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            {% for category, message in messages %}
                <div class="flash {{ category }}">{{ message }}</div>
            {% endfor %}
        {% endif %}
    {% endwith %}
    <form method="POST">
        <label>金额: <input type="number" step="0.01" name="amount" required></label><br>
        <label>描述: <input type="text" name="description"></label><br>
        <label>交易日期: <input type="date" name="transaction_date" value="{{ today_date }}" required></label><br>
        <button type="submit">添加</button>
    </form>
    <a href="{{ url_for('cash_records') }}">返回库存现金记录</a>
    <a href="{{ url_for('index') }}">返回主页</a>
</body>
</html>